import React, { PureComponent } from 'react'
import { Provider } from 'react-redux'
import request from '../../../api/api'
import List from './List/List'
import NiceList from './NiceList/NiceList'
import "./Hot.scss"
import store from '../../../redux/store'
export default class Hot extends PureComponent {
  state = {
    nicelist: [],
    list: [],
  }
  getNiceList = () => {
    request({
      url: '/api/maoyan/index/topRatedMovies',
      method: 'get'
    }).then(res => {
      this.setState({
        nicelist: res.movieList,
      })
    })
  }
  getList = () => {
    request({
      url: '/api/maoyan/index/movieOnInfoList',
      method: 'get'
    }).then(res => {
      this.setState({
        list: res.movieList,
      })
    })
  }
  componentDidMount() {
    this.getNiceList()
    this.getList()
  }
  render() {
    let { nicelist, list } = this.state
    return (
      <div className='hot'>
        <Provider store={store}>
          <NiceList nicelist={nicelist} />
          <List list={list} />
        </Provider>
      </div>
    )
  }
}
